package com.ylp.sys.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ylp.sys.domain.entity.SysMenu;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 系统菜单表 Mapper 接口
 * </p>
 *
 * @author cc
 * @since 2024-07-24
 */
public interface SysMenuMapper extends BaseMapper<SysMenu> {
    @Select("select m.* from sys_user_role ur JOIN sys_role r ON ur.role_id = r.id " +
            "JOIN sys_role_menu rm ON r.id = rm.role_id JOIN sys_menu m ON rm.menu_id = m.id WHERE m.deleted = 0 " +
            "AND m.status = 0 AND ur.user_id = #{id} ORDER BY sort ASC;")
    List<SysMenu> getMenuListByUserId(@Param("id") Long id);

}
